home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Developer / macgambit-20-compiler-src-p1 / Runtime (.c & .h) / struct.h < prev   
Encoding:
C/C++ Source or Header  |  1994-07-26  |  6.6 KB  |  157 lines  |  [TEXT/KAHL]

  1. /* Definition of data structures */
  2.  
  3. /*---------------------------------------------------------------------------*/
  4.  
  5. /* global variable */
  6.  
  7. struct global_rec { SCM_obj value; long jump_adr; };
  8. typedef struct global_rec *GLOBAL_PTR;
  9.  
  10.  
  11. /* trap trampolines and global jump trampolines */
  12.  
  13. struct trap_rec { short jmp; long adr; short buf; };
  14. typedef struct trap_rec *TRAP_PTR;
  15. typedef short *TRAMP_PTR;
  16.  
  17.  
  18. /* system state description */
  19.  
  20. struct sstate_rec {
  21.   GLOBAL_PTR globals;
  22.   TRAMP_PTR tramps;
  23.   TRAP_PTR traps;
  24.   char *const_bot, *const_bptr, *const_tptr, *const_top;
  25.   char *program_filename;
  26.   long nb_ofiles;
  27.   struct { long len; char *ptr; long stats_bot, stats_top; }
  28.     ofile[MAX_NB_OFILES];
  29.   long stats_on;
  30.   long stats_start_time, stats_stop_time;
  31.   long nb_stats;
  32.   long stats_offsets[MAX_NB_STATS];
  33.   long profiling;
  34.   long debug;
  35.   };
  36.  
  37. typedef struct sstate_rec *SSTATE_PTR;
  38.  
  39.  
  40. /* processor state description */
  41.  
  42. struct pstate_rec {
  43.   long intr_flag;                       /*  0: interrupt flag                */
  44.  
  45.   long **ltq_tail;                      /*  1: allocation ptr, grows down    */
  46.   long **ltq_head;                      /*  2: steal ptr, grows down         */
  47.   long **deq_tail;                      /*  3: allocation ptr, grows up      */
  48.   long **deq_head;                      /*  4: steal ptr, grows up           */
  49.   long **q_bot;                         /*  5: bottom of area for ltq & deq  */
  50.   long **q_top;                         /*  6: top of area                   */
  51.  
  52.   long *stack_lim;                      /*  7: allocation limit              */
  53.   long *stack_ptr;                      /*  8: allocation ptr, grows down    */
  54.   long *stack_bot;                      /*  9: bottom of stack area          */
  55.   long *stack_top;                      /* 10: top of stack area             */
  56.  
  57.   char *heap_old;                       /* 11: ptr to old space              */
  58.   char *heap_lim;                       /* 12: allocation limit              */
  59.   char *heap_ptr;                       /* 13: allocation ptr, grows down    */
  60.   char *heap_bot;                       /* 14: bottom of Scheme heap         */
  61.   char *heap_top;                       /* 15: top of Scheme heap            */
  62.   char *heap_mid;                       /* 16: middle of Scheme heap         */
  63.  
  64.   char *closure_lim;                    /* 17: closure alloc limit           */
  65.   char *closure_ptr;                    /* 18: closure alloc ptr, grows down */
  66.  
  67.   long workq_lockO, workq_lockV;        /* 19: work queue OWNER/VISITOR lock */
  68.   SCM_obj workq_tail;                   /* 21: tail of work queue            */
  69.   SCM_obj workq_head;                   /* 22: head of work queue            */
  70.  
  71.   SCM_obj current_task;                 /* 23: pointer to current task       */
  72.   SCM_obj parent_ret;                   /* 24: parent continuation ret adr   */
  73.   SCM_obj parent_frame;                 /* 25: parent continuation frame     */
  74.   SCM_obj current_dyn_env;              /* 26: current dynamic environment   */
  75.   SCM_obj temp_task;                    /* 27: preallocated task             */
  76.   SCM_obj bos_ret;                      /* 28: bottom of stack return adr    */
  77.  
  78.   long steal_scan;                      /* 29: scan ptr for stealing         */
  79.   long steal_lockO, steal_lockV;        /* 30: steal OWNER/VISITOR lock      */
  80.  
  81.   SCM_obj response;                     /* 32: response from victim          */
  82.   SCM_obj thief;                        /* 33: thief processor               */
  83.  
  84.   long intr_other;                      /* 34: true if any of these true:    */
  85.   long intr_barrier;                    /* 35: barrier interrupt flag        */
  86.   long intr_timer;                      /* 36: interval timer interrupt flag */
  87.   long intr_user;                       /* 37: user interrupt flag           */
  88.   long intr_io;                         /* 38: io interrupt flag             */
  89.  
  90.   void (*flush_writes)();               /* 39: procedure to flush mem writes */
  91.  
  92.   long temp1, temp2;                    /* 40: temporary values              */
  93.  
  94.   long heap_margin;                     /* 42: size of heap margin zone      */
  95.   long stack_margin;                    /* 43: size of stack margin zone     */
  96.   long heap_max_margin;                 /* 44: max heap margin               */
  97.   long stack_max_margin;                /* 45: max stack margin              */
  98.  
  99.   SCM_obj count1, count2;               /* 46: counters for statistics       */
  100.  
  101.   SCM_obj processor_storage[56-48];     /* 48: processor Scheme storage      */
  102.  
  103.   long reserved2[59-56];                /* 56: reserved for future use       */
  104.  
  105.   long *elog_bot;                       /* 59: bottom of event log area      */
  106.   long *elog_top;                       /* 60: top of event log area         */
  107.   long *elog_ptr;                       /* 61: allocation ptr, grows down    */
  108.  
  109.   SCM_obj id;                           /* 62: processor number              */
  110.   SCM_obj nb_processors;                /* 63: number of processors          */
  111.  
  112.   struct pstate_rec *ps[MAX_NB_PROC];   /* 64: table of all processors       */
  113.   struct pstate_rec *steal_ps[MAX_NB_PROC];/* randomized table of processors */
  114.  
  115.   char *emul_code_bot;                  /* bottom of emulation code          */
  116.   char *emul_code_top;                  /* top of emulation code             */
  117.   char *emul_code_ptr;                  /* allocation ptr, grows up          */
  118.  
  119.   char *local_heap_bot;                 /* bottom of local heap              */
  120.   char *local_heap_top;                 /* top of local heap                 */
  121.   char *local_heap_ptr;                 /* allocation ptr, grows up          */
  122.  
  123.   long *stats_counters;                 /* ptr to statistics counters        */
  124.  
  125.   short *prof_bot;                      /* bottom of profiling counters      */
  126.   short *prof_top;                      /* top of profiling counters         */
  127.  
  128.   long sync0, sync1, sync2;             /* used for barrier sync             */
  129.   long sync0_msg1, sync1_msg1, sync2_msg1;
  130.   long sync0_msg2, sync1_msg2, sync2_msg2;
  131.  
  132.   long cpu_times[2];
  133.   long stats_cpu_times[2];
  134.  
  135.   long temp[4];
  136.  
  137.   IEEE_FP64 *fp_ptr;
  138.   IEEE_FP80 fp0, fp_cmp1, fp_cmp2;
  139.   };
  140.  
  141. typedef struct pstate_rec *PSTATE_PTR;
  142.  
  143.  
  144. #define table            ((long)sstate->const_bot-0x8000L)
  145. #define table_offset(x)  ((long)(x)-(long)sstate->const_bot+0x8000L)
  146. #define pstate_offset(x) ((long)(x)-(long)pstate)
  147.  
  148.  
  149. /*---------------------------------------------------------------------------*/
  150.  
  151. /* global data structures */
  152.  
  153. extern SSTATE_PTR sstate;  /* pointer to system state           */
  154. extern PSTATE_PTR pstate;  /* pointer to this processor's state */
  155.  
  156. /*---------------------------------------------------------------------------*/
  157.